/* For PC version of glob.
 * Supplies #defines for DIR, direct, readdir, opendir & closedir.
 */

#ifdef __TURBOC__

#include <dos.h>
#include <dir.h>

#define ALL_FILES	FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC|FA_ARCH
#define FFBLK		ffblk
#define FF_NAME		ff_name
#define FF_ATTRIB	ff_attrib
#define FF_FTIME	ff_ftime
#define FF_FDATE	ff_fdate
#define FF_FSIZE	ff_fsize

#endif

#ifdef __MSC__

#include <dos.h>

#define ALL_FILES	_A_NORMAL|_A_RDONLY|_A_HIDDEN|_A_SYSTEM|_A_SUBDIR
#define FFBLK		find_t
#define FF_ATTRIB	attrib
#define FF_FTIME	wr_time
#define FF_FDATE	wr_date
#define FF_FSIZE	size
#define FF_NAME		name
#define FA_RDONLY	_A_RDONLY
#define FA_HIDDEN	_A_HIDDEN
#define FA_SYSTEM	_A_SYSTEM
#define FA_SUBDIR	_A_DIREC
#define FA_ARCH		_A_ARCH
#define findfirst(a, b, c)	_dos_findfirst((a), (c), (b))
#define findnext		_dos_findnext
#endif /* __MSC__ */

struct ddir {
	struct FFBLK	d_ffblk;
	int		name_used;
};
typedef struct ddir DIR;

typedef unsigned short u_short;

struct direct {
	/* This is not the full structure as defined in 'ndir.h'.
	 * One day I'll do the right thing and plug the others in and use them
	 * in ls & ll etc. I suspect the following should be there (from
	 * System V 'dir.h'):
	 */
	u_short	d_ino;
	u_short	d_reclen;
	u_short	d_namlen;
	char	d_name[15]; /* Allows A:file1234.123 */
	char	d_pad[10];
};

DIR *opendir();
struct direct *readdir();

/* For emacs:
 * Local Variables:
 * tab-width: 8
 * End:
 */
